/**
 */
package ConnectorGenerator.ElementArchitecture.impl;

import ConnectorGenerator.ElementArchitecture.ElementArchitecturePackage;
import ConnectorGenerator.ElementArchitecture.LocalBinding;
import ConnectorGenerator.ElementArchitecture.Port;
import ConnectorGenerator.ElementArchitecture.SubElement;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Local Binding</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ConnectorGenerator.ElementArchitecture.impl.LocalBindingImpl#getSourceSubElement <em>Source Sub Element</em>}</li>
 *   <li>{@link ConnectorGenerator.ElementArchitecture.impl.LocalBindingImpl#getSourcePort <em>Source Port</em>}</li>
 *   <li>{@link ConnectorGenerator.ElementArchitecture.impl.LocalBindingImpl#getDestinationSubElement <em>Destination Sub Element</em>}</li>
 *   <li>{@link ConnectorGenerator.ElementArchitecture.impl.LocalBindingImpl#getDestinationPort <em>Destination Port</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LocalBindingImpl extends EObjectImpl implements LocalBinding {
	/**
	 * The cached value of the '{@link #getSourceSubElement() <em>Source Sub Element</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSourceSubElement()
	 * @generated
	 * @ordered
	 */
	protected SubElement sourceSubElement;

	/**
	 * The cached value of the '{@link #getSourcePort() <em>Source Port</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSourcePort()
	 * @generated
	 * @ordered
	 */
	protected Port sourcePort;

	/**
	 * The cached value of the '{@link #getDestinationSubElement() <em>Destination Sub Element</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDestinationSubElement()
	 * @generated
	 * @ordered
	 */
	protected SubElement destinationSubElement;

	/**
	 * The cached value of the '{@link #getDestinationPort() <em>Destination Port</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDestinationPort()
	 * @generated
	 * @ordered
	 */
	protected Port destinationPort;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LocalBindingImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ElementArchitecturePackage.Literals.LOCAL_BINDING;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SubElement getSourceSubElement() {
		if (sourceSubElement != null && sourceSubElement.eIsProxy()) {
			InternalEObject oldSourceSubElement = (InternalEObject)sourceSubElement;
			sourceSubElement = (SubElement)eResolveProxy(oldSourceSubElement);
			if (sourceSubElement != oldSourceSubElement) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ElementArchitecturePackage.LOCAL_BINDING__SOURCE_SUB_ELEMENT, oldSourceSubElement, sourceSubElement));
			}
		}
		return sourceSubElement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SubElement basicGetSourceSubElement() {
		return sourceSubElement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSourceSubElement(SubElement newSourceSubElement) {
		SubElement oldSourceSubElement = sourceSubElement;
		sourceSubElement = newSourceSubElement;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ElementArchitecturePackage.LOCAL_BINDING__SOURCE_SUB_ELEMENT, oldSourceSubElement, sourceSubElement));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Port getSourcePort() {
		if (sourcePort != null && sourcePort.eIsProxy()) {
			InternalEObject oldSourcePort = (InternalEObject)sourcePort;
			sourcePort = (Port)eResolveProxy(oldSourcePort);
			if (sourcePort != oldSourcePort) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ElementArchitecturePackage.LOCAL_BINDING__SOURCE_PORT, oldSourcePort, sourcePort));
			}
		}
		return sourcePort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Port basicGetSourcePort() {
		return sourcePort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSourcePort(Port newSourcePort) {
		Port oldSourcePort = sourcePort;
		sourcePort = newSourcePort;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ElementArchitecturePackage.LOCAL_BINDING__SOURCE_PORT, oldSourcePort, sourcePort));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SubElement getDestinationSubElement() {
		if (destinationSubElement != null && destinationSubElement.eIsProxy()) {
			InternalEObject oldDestinationSubElement = (InternalEObject)destinationSubElement;
			destinationSubElement = (SubElement)eResolveProxy(oldDestinationSubElement);
			if (destinationSubElement != oldDestinationSubElement) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_SUB_ELEMENT, oldDestinationSubElement, destinationSubElement));
			}
		}
		return destinationSubElement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SubElement basicGetDestinationSubElement() {
		return destinationSubElement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDestinationSubElement(SubElement newDestinationSubElement) {
		SubElement oldDestinationSubElement = destinationSubElement;
		destinationSubElement = newDestinationSubElement;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_SUB_ELEMENT, oldDestinationSubElement, destinationSubElement));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Port getDestinationPort() {
		if (destinationPort != null && destinationPort.eIsProxy()) {
			InternalEObject oldDestinationPort = (InternalEObject)destinationPort;
			destinationPort = (Port)eResolveProxy(oldDestinationPort);
			if (destinationPort != oldDestinationPort) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_PORT, oldDestinationPort, destinationPort));
			}
		}
		return destinationPort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Port basicGetDestinationPort() {
		return destinationPort;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDestinationPort(Port newDestinationPort) {
		Port oldDestinationPort = destinationPort;
		destinationPort = newDestinationPort;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_PORT, oldDestinationPort, destinationPort));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ElementArchitecturePackage.LOCAL_BINDING__SOURCE_SUB_ELEMENT:
				if (resolve) return getSourceSubElement();
				return basicGetSourceSubElement();
			case ElementArchitecturePackage.LOCAL_BINDING__SOURCE_PORT:
				if (resolve) return getSourcePort();
				return basicGetSourcePort();
			case ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_SUB_ELEMENT:
				if (resolve) return getDestinationSubElement();
				return basicGetDestinationSubElement();
			case ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_PORT:
				if (resolve) return getDestinationPort();
				return basicGetDestinationPort();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ElementArchitecturePackage.LOCAL_BINDING__SOURCE_SUB_ELEMENT:
				setSourceSubElement((SubElement)newValue);
				return;
			case ElementArchitecturePackage.LOCAL_BINDING__SOURCE_PORT:
				setSourcePort((Port)newValue);
				return;
			case ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_SUB_ELEMENT:
				setDestinationSubElement((SubElement)newValue);
				return;
			case ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_PORT:
				setDestinationPort((Port)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ElementArchitecturePackage.LOCAL_BINDING__SOURCE_SUB_ELEMENT:
				setSourceSubElement((SubElement)null);
				return;
			case ElementArchitecturePackage.LOCAL_BINDING__SOURCE_PORT:
				setSourcePort((Port)null);
				return;
			case ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_SUB_ELEMENT:
				setDestinationSubElement((SubElement)null);
				return;
			case ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_PORT:
				setDestinationPort((Port)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ElementArchitecturePackage.LOCAL_BINDING__SOURCE_SUB_ELEMENT:
				return sourceSubElement != null;
			case ElementArchitecturePackage.LOCAL_BINDING__SOURCE_PORT:
				return sourcePort != null;
			case ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_SUB_ELEMENT:
				return destinationSubElement != null;
			case ElementArchitecturePackage.LOCAL_BINDING__DESTINATION_PORT:
				return destinationPort != null;
		}
		return super.eIsSet(featureID);
	}

} //LocalBindingImpl
